package com.ymatou.iapi.livebuyer.testcase;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.experimental.categories.Category;

import com.ymatou.iapi.livebuyer.parameter.SendGroupMessageBean;
import com.ymatou.iapi.livebuyer.service.SendGroupMessageCall;
import com.ymt.core.tool.Logger;
import com.ymt.utils.annotation.*;
import com.ymt.utils.tag.*;
import com.ymttest.business.service.LiveRoomCallService;
import com.ymttest.utils.YMTDateUtil;
/**
*发送群组消息
*FreeMaker Template自动生成代码
*/
@TestSuite
public class Ts_SendGroupMessage{
	private static SendGroupMessageBean sendgroupmessageBean;
	private static SendGroupMessageCall sendgroupmessageCall;
	//?这个id需要客户端生成
	private static String groupid="@TGS#aGVENU5EP";
	@BeforeClass
	public static void setUp() {
		Logger.createResultFile("发送群组消息");
	}

	@Before
	public void caseUp() {
		sendgroupmessageBean=new SendGroupMessageBean();
		sendgroupmessageCall=new SendGroupMessageCall();
	}

	@AfterClass
	public static void tearDown() {
		Logger.generateResult(sendgroupmessageCall.getOpurl());
	}

	@After
	public void caseDown() {
		Logger.end();
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_SendGroupMessage_001() {
		Logger.start(true,"发送群组消息成功");
		try {
			String groupid=LiveRoomCallService.CreateGroup("autoTest"+YMTDateUtil.getDate().getTime());
			sendgroupmessageBean.setGroupId(groupid);
			sendgroupmessageBean.setContent("test");
			sendgroupmessageCall.setData(sendgroupmessageBean);
			sendgroupmessageCall.callService();			
			Logger.verifyEquals("200", sendgroupmessageCall.getString("code"), "判断code是否为200");
			Logger.verifyEquals("操作成功", sendgroupmessageCall.getString("message"), "判断message");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P3.class})
	@TestCase
	public void Tc_SendGroupMessage_002() {
		Logger.start(true,"不输入groupid失败");
		try {
			sendgroupmessageBean.setContent("test");
			sendgroupmessageCall.setData(sendgroupmessageBean);
			sendgroupmessageCall.callService();			
			Logger.verifyEquals("100", sendgroupmessageCall.getString("code"), "判断code");
			Logger.verifyIsContains("错误的请求参数", sendgroupmessageCall.getString("message"), "判断message");
		} catch (Exception e) {

		}
	}
	@Test
	@Category({P3.class})
	@TestCase
	public void Tc_SendGroupMessage_003() {
		Logger.start(true,"不输入countent失败");
		try {
			sendgroupmessageBean.setGroupId(groupid);
			sendgroupmessageCall.setData(sendgroupmessageBean);
			sendgroupmessageCall.callService();			
			Logger.verifyEquals("100", sendgroupmessageCall.getString("code"), "判断code");
			Logger.verifyIsContains("错误的请求参数", sendgroupmessageCall.getString("message"), "判断message");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
}